home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / GNU / LIBC / BYTEORDER next >
Text File  |  1997-05-04  |  751b  |  26 lines

  1. /* unsigned long int htonl(unsigned long int HOSTLONG)
  2.  */
  3.  
  4. htonl:
  5. ntohl:
  6.   eor     r1, r0, r0, ror #16      @ aEORc bEORd   aEORc   bEORd
  7.   bic     r1, r1, #&00ff0000       @ aEORc   0     aEORc   bEORd
  8.   mov     r0, r0, ror #8           @   d     a       b       c
  9.   eor     r0, r0, r1, lsr #8       @   d     c       b       a
  10. #ifdef 26BIT /* is there a predefined symbol for this? */
  11.   movs    pc, r14
  12. #else /* 26BIT */
  13.   mov     pc, r14
  14. #endif /* 26BIT */
  15.  
  16. htons:
  17. ntohs:
  18.   and     r1, r0, #0xff            @ 0  0  0  b
  19.   mov     r0, r0, lsr #8           @ 0  0  0  a
  20.   orr     r0, r0, r1, lsl #8       @ 0  0  b  a
  21. #ifdef 26BIT /* is there a predefined symbol for this? */
  22.   movs    pc, r14
  23. #else /* 26BIT */
  24.   mov     pc, r14
  25. #endif /* 26BIT */
  26.